const fs = require("fs");
const path=require("path");

let oldPath=path.join(__dirname,"to.txt");
let newPath=path.join(__dirname,"new.txt")
fs.renameSync(oldPath,newPath,(err)=>{
    if(err){
        console.log(err)
    }
})